from fastapi import APIRouter, Depends

from forward.api.admin.schemas.operator import (
    OperatorConfigInSchema,
    OperatorListInSchema,
)
from forward.api.admin.service.operator import OperatorService

operator = APIRouter(prefix="/operator")


@operator.post("/lists")
async def list(
    list_in: OperatorListInSchema,
    operator_service: OperatorService = Depends(OperatorService.instance),
):
    return await operator_service.lists(list_in)


@operator.post("/set_config")
async def set_config(
    config_in: OperatorConfigInSchema,
    operator_service: OperatorService = Depends(OperatorService.instance),
):
    return await operator_service.set_config(config_in)
